package com.zzn.bookManage.util;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class StringUtil {
    public static boolean notNull(String s){
        return s!=null;
    }

    public static boolean notBlank(String s){
        return s!=null && (!"".equals(s));
    }
    public static boolean isBlank(String s){
        return s==null || ("".equals(s));
    }

    public static String decode64(String encodedString){
        return new String(Base64.getDecoder().decode(encodedString));
    }
    public static String encode64(String raw){
        return Base64.getEncoder().encodeToString(raw.getBytes(StandardCharsets.UTF_8));
    }

    public static boolean notEqual(String s1,String s2) {
        return notBlank(s1) && notBlank(s2) && !s1.equals(s2);
    }
}
